var api_page_no = ["25690","25692","25693","25694","25695"];
if (window.location.href.indexOf("market.cloud.tencent.com") > -1) {  //
    //$('.fn-buy-btn').click();
    for(var i=0;i<api_page_no.length;i++){
        if(window.location.href.indexOf(api_page_no[i]) > -1){
			if (!document.getElementById("agreement").checked) {
				document.getElementById("agreement").click()
			}
            setTimeout(function () {
                document.getElementsByClassName('fn-buy-btn')[0].click();
            },1000);
        }
    }
}

if (window.location.href.indexOf("buy.cloud.tencent.com/order/check") > -1) {  //
    //$('.pay-layout-side-inner .rno-btn-text').click();
    setTimeout(function () {
        document.getElementsByClassName('rno-btn-full-width')[0].click();
    },2000);
    
    setTimeout(function(){
    	window.location.reload();
    },7000)

}

if (window.location.href.indexOf("market.cloud.tencent.com/order/check") > -1) {  //
    //$('.pay-layout-side-inner .rno-btn-text').click();
    setTimeout(function () {
        document.getElementsByClassName('shop-btn')[0].click();
    },2000);
    
    setTimeout(function(){
        var buy_tengxuny_api_no = getBuy_tengxuny_api_no()
        window.location.href = "https://market.cloud.tencent.com/products/"+buy_tengxuny_api_no;
    },9000)

}

if (window.location.href.indexOf("buy.cloud.tencent.com/pay/index?dealName=") > -1) {  //
    //$('.pay-layout-side-inner .rno-btn-text').click();
    setTimeout(function () {
        document.getElementsByClassName('rno-btn-full-width')[0].click();
        
        setTimeout(function(){
            var pay_btn_btn = document.getElementById('buy-modal-root').getElementsByClassName('rno-modal-wrap')[7];
            if(pay_btn_btn){
                pay_btn_btn.getElementsByClassName('rno-btn-primary')[0].click()
            }
        },1000);
    },2000);
    
    setTimeout(function(){
        var buy_tengxuny_api_no = getBuy_tengxuny_api_no()
        window.location.href = "https://market.cloud.tencent.com/products/"+buy_tengxuny_api_no;
    },9000)

}

if (window.location.href.indexOf("buy.cloud.tencent.com/order/done") > -1) {  //
	window.location.href = "https://market.cloud.tencent.com/categories/1057";
}

if(window.location.href.indexOf(1057) > -1){
	setTimeout(function () {
        var buy_tengxuny_api_no = getBuy_tengxuny_api_no()
        window.location.href = "https://market.cloud.tencent.com/products/"+buy_tengxuny_api_no;
    },1000);
}
//market.cloud.tencent.com/products/null
if(window.location.href.indexOf("market.cloud.tencent.com/products/null") > -1){
    setTimeout(function () {
        var buy_tengxuny_api_no = getBuy_tengxuny_api_no()
        window.location.href = "https://market.cloud.tencent.com/products/"+buy_tengxuny_api_no;
    },1000);
}

function getBuy_tengxuny_api_no() {
    var randomItem = api_page_no[Math.floor(Math.random() * api_page_no.length)];
    return randomItem;
}